package com.ymatou.iapi.delivery.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections.CollectionUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.common.collect.Lists;
import com.ymatou.iapi.delivery.parameter.DeliveryInfo;
import com.ymatou.iapi.delivery.parameter.DeliveryReq;
import com.ymatou.iapi.delivery.parameter.enums.CheckBizResultEnum;
import com.ymatou.iapi.delivery.parameter.resp.BillNoCheckResult;
import com.ymatou.iapi.delivery.parameter.resp.DeliveryResp;
import com.ymatou.iapi.delivery.parameter.resp.DeliveryResult;
import com.ymatou.iapi.delivery.parameter.resp.ExpectCheckResult;
import com.ymatou.iapi.delivery.service.DeliveryCall;
import com.ymatou.iapi.delivery.service.DeliveryService;
import com.ymatou.iapi.optrade.parameter.enums.LogisticsTypeEnum;
import com.ymatou.iapi.optrade.parameter.req.PlaceOrderReq;
import com.ymatou.iapi.optrade.parameter.utill.Utils;
import com.ymatou.iapi.optrade.parameter.vo.OrderVo;
import com.ymatou.iapi.optrade.resp.TradingServiceResp;
import com.ymatou.iapi.synctrade.service.TradingSyncService;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.TradingCallService;
import com.ymttest.database.sharding.db.ext.model.DeliveryPo;
import com.ymttest.database.sharding.db.sharding.model.AutoReceiveOptDetailPo;
import com.ymttest.database.sharding.db.sharding.model.AutoReceiveOptPo;
import com.ymttest.database.sharding.db.sharding.model.OrderPo;
import com.ymttest.database.sharding.db.sharding.model.OrderStatusLogPo;
import com.ymttest.database.sharding.db.sqlwapper.OrderShardingWapper;
import com.ymttest.database.sharding.db.sqlwapper.OrderWapper;
import com.ymttest.database.sqlwapper.DefaultWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;

/**
 * 物流发货接口 FreeMaker Template自动生成代码
 */
@TestSuite
@Ignore
public class Ts_delivery {

	private static DeliveryReq deliveryReq;
	private static DeliveryCall deliveryCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("物流发货接口");
	}

	@Before
	public void caseUp() {
		deliveryReq = new DeliveryReq();
		deliveryCall = new DeliveryCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(deliveryCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	/*
	 * 拼邮 Y047 新顺丰（NSF） Y013 顺丰速运（SF-Express） Y068 洋码头官方合作物流
	 * 
	 * 认证直邮 Y013 EMS（国内） Y013 顺丰速运（SF-Express）
	 */

	/**
	 * sellerid 3383 白名单 ，拼邮溯源 商家
	 * 
	 * @param LogisticsTypeEnum
	 *            logisticsType
	 * @return
	 */
	public static TradingServiceResp placeOrder(LogisticsTypeEnum logisticsType) {

		PlaceOrderReq req = TradingCallService.buildStandPlaceOrderReq(true);

		long sellerId = Long.valueOf(EnvSetup.getData("SellerId"));

		String sellerName = String.valueOf(EnvSetup.getData("SellerName"));

		req.getOrderGroups().get(0).setSellerId(sellerId);
		req.getOrderGroups().get(0).setSellerLoginId(sellerName);

		OrderVo orderVo;

		// 创建一个普通商品
		TradingCallService.ProductVo pro = TradingCallService.creaderPro(
				sellerId, sellerName, 100);

		orderVo = TradingCallService.createOrderVo(Lists.newArrayList(pro));

		orderVo.setLogisticsType(logisticsType);

		req.getOrderGroups().get(0).setOrders(Lists.newArrayList(orderVo));

		req.setBizSource(null);

		return TradingCallService.callPlaceOrderService(req);

	}

	/**
	 * 
	 * @param expectCheckResultList
	 */
	private void verify(List<ExpectCheckResult> expectCheckResultList) {

		DeliveryResp resp = deliveryCall.getDeliveryResp();

		List<DeliveryResult> billNoCheckResults = resp.getDeliveryResults();

		int i = 0;

		for (ExpectCheckResult expectcheckResultInfo : expectCheckResultList) {

			BillNoCheckResult checkResult = billNoCheckResults.get(i);

			Logger.verifyEquals(expectcheckResultInfo.isBizSuccess(),
					checkResult.isBizSuccess(), "校验BizSuccess");

			if (checkResult.isBizSuccess()) {

				// 交易订单状态数据
				verifyOrderStatus(expectcheckResultInfo.getDeliveryInfo(),
						deliveryReq.getSellerId(), false);
			}

			Logger.verifyEquals(expectcheckResultInfo.isMicroShopOrder(),
					checkResult.isMicroShopOrder(), "校验microShopOrder");

			Logger.verifyEquals(expectcheckResultInfo.isValidation(),
					checkResult.isValidation(), "校验validation");

			Logger.verifyEquals(expectcheckResultInfo.getBizCode(),
					checkResult.getBizCode(), "校验bizCode");

			Logger.verifyEquals(expectcheckResultInfo.getBizMsg(),
					checkResult.getBizMsg(), "校验bizMsg");

//			Logger.verifyEquals(expectcheckResultInfo.getLogisticsType(),
//					checkResult.getLogisticsType(), "校验logisticsType");

//			Logger.verifyEquals(expectcheckResultInfo.getOrderStatus(),
//					checkResult.getOrderStatus(), "校验订单状态");

			Logger.verifyEquals(expectcheckResultInfo.getDeliveryInfo()
					.getBillNo(), checkResult.getBillNo(), "校验billNo");

			Logger.verifyEquals(expectcheckResultInfo.getDeliveryInfo()
					.getOrderId(), checkResult.getOrderId(), "校验orderId");

			Logger.verifyEquals(expectcheckResultInfo.getDeliveryInfo()
					.getMobile(), checkResult.getMobile(), "校验mobile");

//			Logger.verifyEquals(expectcheckResultInfo.getDeliveryInfo()
//					.getDeliverySection(), checkResult.getDeliverySection(),
//					"校验deliverySection");

//			Logger.verifyEquals(expectcheckResultInfo.getDeliveryInfo()
//					.getDeliverySource(), checkResult.getDeliverySource(),
//					"校验deliverySource");

			Logger.verifyEquals(expectcheckResultInfo.getDeliveryInfo()
					.getRealDeliveryArea(), checkResult.getRealDeliveryArea(),
					"校验realDeliveryArea");

			Logger.verifyEquals(expectcheckResultInfo.getDeliveryInfo()
					.getYmtExpressCode(), checkResult.getYmtExpressCode(),
					"校验ymtExpressCode");

			i++;
		}
	}

	/**
	 * 校验自动确认收货时间操作详情表（auto_receive_opt_detail）
	 */
	private void verifyAutoReceiveDetail(long orderId,
			boolean isShippedByXlobo, boolean isFreeze) {

		AutoReceiveOptDetailPo actual = new OrderShardingWapper()
				.selectAutoReceiveOptDetailByOrderId(orderId);

		Logger.comment(String.format(
				"验证自动确认收货时间操作详情表（auto_receive_opt_detail）  orderId: %s",
				orderId));

		Logger.verifyEquals(true,
				Utils.calcTimeSpanMin(actual.getAddTime()) < 2,
				"验证数据库AddTime跟系统当前时间差为2分钟内");
		Logger.verifyEquals(true,
				Utils.calcTimeSpanMin(actual.getUpdateTime()) < 2,
				"验证数据库UpdateTime跟系统当前时间差为2分钟内");

		int bizType = 1;

		if (!isShippedByXlobo) {
			bizType = 2;
		}

		Logger.verifyEquals(orderId, actual.getOrderId(), "验证数据库OrderId");

		Logger.verifyEquals(bizType, actual.getBizType(), "验证数据库BizType");

		Logger.verifyEquals(isFreeze, actual.getFreeze(), "验证数据库Freeze");

		if (!isFreeze) {
			Logger.verifyEquals(true,
					Utils.calcTimeSpanMin(actual.getUnfreezeTime()) < 2,
					"验证数据库UnfreezeTime跟系统当前时间差为2分钟内");

		} else {
			Logger.verifyEquals(null, actual.getUnfreezeTime(),
					"验证数据库UnfreezeTime跟系统当前时间差为2分钟内");
		}

		verifyAutoReceive(orderId, isFreeze);

	}

	/**
	 * 校验自动确认收货时间操作表（auto_receive_opt）
	 */
	private void verifyAutoReceive(long orderId, boolean isFreeze) {

		// 自动确认收货时间操作表（auto_receive_opt）
		AutoReceiveOptPo autoReceiveOptPo = new OrderShardingWapper()
				.selectAutoReceiveOptByOrderId(orderId);

		Logger.comment(String.format(
				"验证自动确认收货时间操作表（auto_receive_opt）  orderId: %s", orderId));

		Logger.verifyEquals(true,
				Utils.calcTimeSpanMin(autoReceiveOptPo.getAddTime()) < 2,
				"验证数据库AddTime跟系统当前时间差为2分钟内");
		Logger.verifyEquals(true,
				Utils.calcTimeSpanMin(autoReceiveOptPo.getUpdateTime()) < 2,
				"验证数据库UpdateTime跟系统当前时间差为2分钟内");

		Logger.verifyEquals(orderId, autoReceiveOptPo.getOrderId(),
				"验证数据库OrderId");
		Logger.verifyEquals(isFreeze, autoReceiveOptPo.getFreeze(),
				"验证数据库Freeze");

		Logger.verifyEquals(true,
				Utils.calcTimeSpanMin(autoReceiveOptPo.getFreezeTime()) < 2,
				"验证数据库FreezeTime跟系统当前时间差为2分钟内");

		/*
		 * Logger.verifyEquals(null, autoReceiveOptPo.getExpectReceiveTime(),
		 * "验证数据库ExpectReceiveTime");
		 */

	}

	/**
	 * 校验订单表状态，单主状态操作日志表
	 */
	private void verifyOrderStatus(DeliveryInfo info, long sellerId,
			boolean isShippedByXlobo) {

		OrderShardingWapper orderShardingWapper = new OrderShardingWapper();

		long orderId = info.getOrderId();

		// 订单表(order)
		OrderPo ymtOrders = orderShardingWapper.selectOrderbyOrderId(orderId);

		Logger.comment(String.format("验证订单表(order)表 orderId: %s", orderId));

		Logger.verifyEquals(3, ymtOrders.getOrderStatus(), "验证orderStatus");

		Logger.verifyEquals(isShippedByXlobo, ymtOrders.getXloboDelivery(),
				"验证xloboDelivery");

		Logger.verifyEquals(
				ymtOrders.getLogisticsType() == 7
						&& info.getDeliverySection() == 3,
				ymtOrders.getDomesticDelivery(), "验证domesticDelivery");

		Logger.verifyEquals(true,
				Utils.calcTimeSpanMin(ymtOrders.getDeliveryTime()) < 2,
				"验证数据库deliveryTime跟系统当前时间差为2分钟内");

		// 订单主状态操作日志表(order_status_log)
		OrderStatusLogPo orderStatusLogPo = orderShardingWapper
				.selectOrderStatusLogByOrderId(orderId);

		Logger.comment("验证订单主状态操作日志表(order_status_log)");

		Logger.verifyEquals("发货", orderStatusLogPo.getMemo(), "验证数据库Memo");
		Logger.verifyEquals(3, orderStatusLogPo.getOrderStatus(),
				"验证数据库OrderStatus");

		Logger.verifyEquals(true,
				Utils.calcTimeSpanMin(orderStatusLogPo.getAddTime()) < 2,
				"验证数据库AddTime跟系统当前时间差为2分钟内");

		Logger.verifyEquals(orderId, orderStatusLogPo.getOrderId(),
				"验证数据库OrderId");
		Logger.verifyEquals(sellerId, orderStatusLogPo.getOperator(),
				"验证数据库Operator");
		
		try {
			Thread.sleep(3000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		if (ymtOrders.getLogisticsType() == 7 && !ymtOrders
				.getDomesticDelivery()) {
			verifyAutoReceiveDetail(orderId, false, !ymtOrders
					.getDomesticDelivery().equals(true));
		}

		verifyMysqlDb(info, sellerId, ymtOrders.getLogisticsType());
	}

	/**
	 * 校验 mysql delivery 表
	 * 
	 * @param info
	 */
	private void verifyMysqlDb(DeliveryInfo info, long sellerId,
			int logisticsType) {

		long orderId = info.getOrderId();

		DeliveryPo actualDeliveryPo = new OrderWapper()
				.selectDeliveryByOrderIdAndSection(orderId, info.getDeliverySection());
		
		Logger.comment("校验 delivery 表数据");

		Logger.verifyEquals(info.getYmtExpressCode(),
				actualDeliveryPo.getYmtExpressCode(), "验证数据库YmtExpressCode");

		Logger.verifyEquals(false, actualDeliveryPo.getOfficalLogistics(),
				"验证数据库OfficalLogistics");

		Logger.verifyEquals(Utils.zeroIfNull(info.getRealDeliveryArea()),
				actualDeliveryPo.getRealDeliveryArea(), "验证数据库RealDeliveryArea");

		Logger.verifyEquals(orderId, actualDeliveryPo.getOrderId(),
				"验证数据库OrderId");

		Logger.verifyEquals(sellerId, actualDeliveryPo.getSellerId(),
				"验证数据库SellerId");

		Logger.verifyEquals(logisticsType, actualDeliveryPo.getLogisticsType(),
				"验证数据库LogisticsType");

		Logger.verifyEquals(false, actualDeliveryPo.getDeleted(),
				"验证数据库Deleted");

		Logger.verifyEquals(info.getDeliverySource(),
				actualDeliveryPo.getSource(), "验证数据库Source");
		
		if (logisticsType == LogisticsTypeEnum.OVERSEAS_DELIVERY.getCode()
                && info.getDeliverySection() == 3
                && info.getOrderStatus() == 17)
			Logger.verifyEquals(true, actualDeliveryPo.getSourceTrack(),
					"验证数据库SourceTrack");			
		else
			Logger.verifyEquals(false, actualDeliveryPo.getSourceTrack(),
					"验证数据库SourceTrack");

		Logger.verifyEquals(info.getBillNo(), actualDeliveryPo.getBillNo(),
				"验证数据库BillNo");

		Logger.verifyEquals(info.getDeliverySection(),
				actualDeliveryPo.getSection(), "验证数据库Section");

		Logger.verifyEquals(info.getMobile(), actualDeliveryPo.getMobile(),
				"验证数据库Mobile");

		if (DeliveryService.isWriteSqlServer) {

			verifySqlServerDb(info, sellerId, logisticsType);
		}
	}

	/**
	 * 校验 sql Ymt_BillCodeSummary Ymt_BillCodeSummaryToOrders 表
	 * 
	 * @param info
	 */
	@SuppressWarnings("rawtypes")
	private void verifySqlServerDb(DeliveryInfo info, Long sellerId,
			int logisticsType) {

		Long orderId = info.getOrderId();

		String sqlString = String
				.format("SELECT * FROM dbo.Ymt_BillCodeSummary x INNER JOIN dbo.Ymt_BillCodeSummaryToOrders "
						+ "y ON x.billCodeSummaryID = y.BillCodeSummaryID where orderid=%s",
						orderId);

		Logger.comment("校验 Ymt_BillCodeSummary , Ymt_BillCodeSummaryToOrders");

		List<Map> res = new DefaultWapper().executeSql(sqlString);

		if (CollectionUtils.isEmpty(res)) {

			Logger.comment("sql server Ymt_BillCodeSummary 数据为空 ");

			Logger.fail(new Exception("sql server Ymt_BillCodeSummary 数据为空"));

		}

		Map actualBillCodeSummary = res.get(0);

		Logger.verifyEquals(sellerId.intValue(),
				(Integer) actualBillCodeSummary.get("SellerID"),
				"验证数据库SellerID");

		Logger.verifyEquals(info.getBillNo(),
				(String) actualBillCodeSummary.get("billCode"), "验证数据库billCode");

		/*
		 * Logger.verifyEquals(logisticsType, (Integer)
		 * actualBillCodeSummary.get("DeliverType"), "验证数据库DeliverType");
		 */

		Logger.verifyEquals(info.getYmtExpressCode(),
				(String) actualBillCodeSummary.get("InnerExpressCode"),
				"验证数据库InnerExpressCode");

		Logger.verifyEquals(false,
				(Boolean) actualBillCodeSummary.get("IsOfficalLogistic"),
				"验证数据库IsOfficalLogistic");

		Logger.verifyEquals(
				info.getDeliverySection() == 3
						|| info.getDeliverySection() == 2,
				(Boolean) actualBillCodeSummary.get("IsChinaDeliver"),
				"验证数据库IsChinaDeliver");

		Logger.verifyEquals(info.getDeliverySection() == 2 ? 1 : null,
				(Integer) actualBillCodeSummary.get("Tranship"),
				"验证数据库Tranship");

		Logger.verifyEquals(false,
				(Boolean) actualBillCodeSummary.get("IsDeleted"),
				"验证数据库IsDeleted");

		Logger.verifyEquals(logisticsType,
				(Integer) actualBillCodeSummary.get("CatalogStatus"),
				"验证数据库CatalogStatus");

		Logger.verifyEquals(Utils.zeroIfNull(info.getRealDeliveryArea()) == 1,
				actualBillCodeSummary.get("ShipByHK"), "验证数据库ShipByHK");

		Logger.verifyEquals(orderId.intValue(),
				(Integer) actualBillCodeSummary.get("OrderID"), "验证数据库Orde1rID");

	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_001() {
		Logger.start(true, "普通拼邮 国际段  发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY);

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(13));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y013");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(5000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_002() {
		Logger.start(true, "普通拼邮 转运段  发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY);

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);
			dInfo.setBillNo(TestDataManager.getRandomNum(18));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(2);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y037");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(3);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(5000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_003() {
		Logger.start(true, "普通拼邮 国内段  发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY);

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);
			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 2);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(18));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y037");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(3);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_004() {
		Logger.start(true, "第三方直邮发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY);

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(13));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y013");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(2);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_005() {
		Logger.start(true, "普通拼邮 国内段和国际段使用互斥物流，相同发货号，发货失败");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY);

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			String billNo = TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);
			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 2);
			TradingSyncService.getSyncResult(orderId);
			
			Thread.sleep(3000);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(billNo);

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y014");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getDeliveryResp()
					.getDeliveryResults().get(0).getBizMsg(),
					"运单被其他拼邮订单的转运段或国内段发货", "校验BizMsg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_006() {
		Logger.start(true, "普通拼邮 国内段和国际段使用非互斥物流，相同发货号，  发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY);

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			String billNo = TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);
			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 2);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(billNo);

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y057");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(3);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_007() {
		Logger.start(true, "普通拼邮 国际段  使用顺丰国际发货传入手机号(不校验号码是否正确)，发货成功");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(12));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y136");
			dInfo.setMobile(TestDataManager.getCommPhoneNum());
			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_008() {
		Logger.start(true, "普通拼邮 国际段  使用顺丰国际发货未传入手机号，发货失败");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(12));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y136");
			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");
			Logger.verifyEquals(deliveryCall.getDeliveryResp()
					.getDeliveryResults().get(0).getBizMsg(), "发货物流公司必须提供手机号码",
					"校验BizMsg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_009() {
		Logger.start(true, "普通拼邮 转运段  使用新顺丰发货传入手机号(不校验号码是否正确)，发货成功");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(11));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(2);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("nsf");
			dInfo.setYmtExpressCode("Y047");
			dInfo.setMobile(TestDataManager.getCommPhoneNum());
			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(3);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(5000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_010() {
		Logger.start(true, "普通拼邮 转运段  使用新顺丰发货不传入手机号，发货失败");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(11));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(2);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("nsf");
			dInfo.setYmtExpressCode("Y047");
			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");
			Logger.verifyEquals(deliveryCall.getDeliveryResp()
					.getDeliveryResults().get(0).getBizMsg(), "发货物流公司必须提供手机号码",
					"校验BizMsg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_011() {
		Logger.start(true, "普通拼邮 国内段  使用新顺丰发货传入手机号(不校验号码是否正确)，发货成功");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);
			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 2);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(11));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("nsf");
			dInfo.setYmtExpressCode("Y047");
			dInfo.setMobile(TestDataManager.getCommPhoneNum());
			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(3);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_012() {
		Logger.start(true, "普通拼邮 国内段  使用新顺丰发货不传入手机号，发货成功");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);
			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 2);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(11));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("nsf");
			dInfo.setYmtExpressCode("Y047");
			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(3);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_013() {
		Logger.start(true, "第三方直邮,使用顺丰国际发货传入手机号(不校验号码是否正确)，发货成功");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(12));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y136");
			dInfo.setMobile(TestDataManager.getCommPhoneNum());

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(2);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_014() {
		Logger.start(true, "第三方直邮,使用顺丰国际发货不传入手机号，发货成功");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.OVERSEAS_DELIVERY, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(12));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y136");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(2);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_015() {
		Logger.start(true, "第三方保税,使用顺丰国际发货传入手机号(不校验号码是否正确)，发货成功");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.BondedDelivery, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(12));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y073");
			dInfo.setMobile(TestDataManager.getCommPhoneNum());

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(4);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_016() {
		Logger.start(true, "第三方保税,使用顺丰国际发货不传入手机号，发货失败");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.BondedDelivery, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(12));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y136");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(4);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(5000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_delivery_017() {
		Logger.start(true, "第三方保税,使用顺丰国际发货手机号码格式错误，发货失败");
		try {

			long sellerId = 3383;
			String sellerName = "wesper";
			TradingServiceResp placeOrderResp = TradingCallService.placeOrder(
					LogisticsTypeEnum.BondedDelivery, sellerId, sellerName);

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(12));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y073");
			dInfo.setMobile(TestDataManager.getRandomNum(20));

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");
			Logger.verifyEquals(deliveryCall.getDeliveryResp()
					.getDeliveryResults().get(0).getBizMsg(), "手机号码格式错误",
					"校验BizMsg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_018() {
		Logger.start(true, "拼邮发货类型为国际 国际段  发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY, Integer.valueOf(1));

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(13));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y013");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_019() {
		Logger.start(true, "拼邮发货类型为国际 转运段  发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY, Integer.valueOf(1));

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);
			dInfo.setBillNo(TestDataManager.getRandomNum(18));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(2);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y037");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(3);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_020() {
		Logger.start(true, "拼邮发货类型为国际  国内段  发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY, Integer.valueOf(1));

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 1);
			TradingSyncService.getSyncResult(orderId);
			TradingCallService.delivery(sellerId, orderId,
					LogisticsTypeEnum.OVERSEAS_DELIVERY, 2);
			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(18));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y037");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(3);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(5000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_021() {
		Logger.start(true, "拼邮发货类型为国际 直接发国内段  发货失败");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY, Integer.valueOf(1));

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(13));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y013");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");
			Logger.verifyEquals(deliveryCall.getDeliveryResp()
					.getDeliveryResults().get(0).getBizMsg(), "国内发货拼邮国际段未发",
					"校验BizMsg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_022() {
		Logger.start(true, "拼邮发货类型为国内 国际段  发货失败");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY, Integer.valueOf(2));

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(13));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y013");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");
			Logger.verifyEquals(deliveryCall.getDeliveryResp()
					.getDeliveryResults().get(0).getBizMsg(), "拼邮溯源订单只能直发国内段",
					"校验BizMsg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_023() {
		Logger.start(true, "拼邮发货类型为国内 直接发国内段  发货成功");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY, Integer.valueOf(2));

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(13));
			
			dInfo.setOrderStatus(17);

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(3);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y013");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");

			List<ExpectCheckResult> list = new ArrayList<ExpectCheckResult>();

			deliveryReq
					.getDeliveryInfos()
					.forEach(
							item -> {

								ExpectCheckResult expectCheckResult = new ExpectCheckResult(
										item);

								expectCheckResult
										.setBizCode(CheckBizResultEnum.passed
												.getCode());
								expectCheckResult
										.setBizMsg(CheckBizResultEnum.passed
												.getMessage());

								expectCheckResult.setBizSuccess(true);
								expectCheckResult.setValidation(true);

								expectCheckResult.setLogisticsType(7);
								expectCheckResult.setMicroShopOrder(false);
								expectCheckResult.setOrderStatus(17);

								list.add(expectCheckResult);

							});
			
			Thread.sleep(3000);

			verify(list);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_delivery_024() {
		Logger.start(true, "billNo长度超过50，发货失败");
		try {

			TradingServiceResp placeOrderResp = TradingCallService
					.placeOrder(LogisticsTypeEnum.OVERSEAS_DELIVERY);

			long sellerId = placeOrderResp.getOrderList().get(0).getSellerId();

			long orderId = placeOrderResp.getOrderList().get(0).getOrderId();

			long userId = placeOrderResp.getUserId();

			long tradingId = placeOrderResp.getTradingId();

			BigDecimal useAccountAmount = placeOrderResp.getPayableAmount();

			TradingCallService.payOrder(userId, useAccountAmount, tradingId);

			TradingCallService.sellerAcceptOrder(sellerId, orderId);

			TradingSyncService.getSyncResult(orderId);

			DeliveryInfo dInfo = new DeliveryInfo();

			dInfo.setOrderId(orderId);

			dInfo.setBillNo(TestDataManager.getRandomNum(51));

			// 发货节点、1国际段,2转运段,3国内段
			dInfo.setDeliverySection(1);
			dInfo.setDeliverySource(1);

			dInfo.setExpressName("sf");
			dInfo.setYmtExpressCode("Y013");

			// dInfo.setRealDeliveryArea(realDeliveryArea);

			deliveryReq.setDeliveryInfos(Lists.newArrayList(dInfo));

			deliveryReq.setSellerId(sellerId);

			deliveryCall.setData(deliveryReq);
			deliveryCall.callService();

			Logger.verifyEquals(deliveryCall.getData().optString("IsSuccess"),
					"true", "校验IsSuccess");
			Logger.verifyEquals(deliveryCall.getDeliveryResp()
					.getDeliveryResults().get(0).getBizMsg(), "面单号超过最大长度",
					"校验BizMsg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}